﻿#include "UI/newUI/SetPositionModeDialog.h"

#include "QRegExp.h"
#include "QValidator.h"
#include "qmessagebox.h"

SetPositionModeDialog::SetPositionModeDialog(QWidget* parent) :QDialog(parent)
{
	ui.setupUi(this);
	connect(ui.pushButton_confirm, &QPushButton::clicked, this, &SetPositionModeDialog::accept);
	connect(ui.pushButton_cancel, &QPushButton::clicked, this, &SetPositionModeDialog::reject);
	ui.lineEdit_rate->turnMode(LineEdit_TurnTableRate::PositionMode);
}

SetPositionModeDialog::~SetPositionModeDialog()
{
}

int SetPositionModeDialog::exec()
{
	return QDialog::exec();
}

void SetPositionModeDialog::accept()//确认
{
	QDialog::accept();
}

float SetPositionModeDialog::getPosition()
{
	return  ui.lineEdit_position->getPosition();
}
float SetPositionModeDialog::getRate()
{
	return ui.lineEdit_rate->getRate();
}
float SetPositionModeDialog::getAcceleration()
{
	return ui.lineEdit_acceleration->getAcceleration();
}
int SetPositionModeDialog::getAccuracy()
{
	return ui.lineEdit_position->getAccuracy();
}
void SetPositionModeDialog::setAccuracy(int accuracy)
{
	ui.lineEdit_position->setAccuracy(accuracy);
	ui.lineEdit_rate->setAccuracy(accuracy);
	ui.lineEdit_acceleration->setAccuracy(accuracy);
}

float SetPositionModeDialog::getTurnTablePositionUpperLimit()
{
	return ui.lineEdit_position->getTurnTablePositionUpperLimit();
}
void SetPositionModeDialog::setTurnTablePositionUpperLimit(float turnTablePositionUpperLimit)
{
	ui.lineEdit_position->setTurnTablePositionUpperLimit(turnTablePositionUpperLimit);
}
float SetPositionModeDialog::getTurnTablePositionLowerLimit()
{
	return ui.lineEdit_position->getTurnTablePositionLowerLimit();
}
void SetPositionModeDialog::setTurnTablePositionLowerLimit(float turnTablePositionLowerLimit)
{
	ui.lineEdit_position->setTurnTablePositionLowerLimit(turnTablePositionLowerLimit);
}
float SetPositionModeDialog::getTurnTableRateUpperLimit()
{
	return ui.lineEdit_rate->getTurnTableRateUpperLimit();
}
void SetPositionModeDialog::setTurnTableRateUpperLimit(float turnTableRateUpperLimit)
{
	ui.lineEdit_rate->setTurnTableRateUpperLimit(turnTableRateUpperLimit);
}
float SetPositionModeDialog::getTurnTableRateLowerLimit()
{
	return ui.lineEdit_rate->getTurnTableRateLowerLimit();
}
void SetPositionModeDialog::setTurnTableRateLowerLimit(float turnTableRateLowerLimit)
{
	ui.lineEdit_rate->setTurnTableRateLowerLimit(turnTableRateLowerLimit);
}
float SetPositionModeDialog::getTurnTableAccelerationUpperLimit()
{
	return ui.lineEdit_acceleration->getTurnTableAccelerationUpperLimit();
}
void SetPositionModeDialog::setTurnTableAccelerationUpperLimit(float  turnTableAccelerationUpperLimit)
{
	ui.lineEdit_acceleration->setTurnTableAccelerationUpperLimit(turnTableAccelerationUpperLimit);
}
float SetPositionModeDialog::getTurnTableAccelerationLowerLimit()
{
	return ui.lineEdit_acceleration->getTurnTableAccelerationLowerLimit();
}
void SetPositionModeDialog::setTurnTableAccelerationLowerLimit(float turnTableAccelerationLowerLimit)
{
	ui.lineEdit_acceleration->setTurnTableAccelerationLowerLimit(turnTableAccelerationLowerLimit);
}